package com.pattern.decorator;

/**
 * @Description: 装饰抽象
 * @Author: whp
 * @Date: 2021-02-07 09:26
 */
public abstract class Decorator extends Comopent{


    private Comopent comopent;

    public Decorator(Comopent comopent){
        //this是一个指向本对象的指针
        this.comopent=comopent;
    }

    /*
     * @Description: 委托给被修饰者执行
     * @Param: []
     * @return void
     **/
    @Override
    public void opr() {
        if(comopent!=null){
            //调用本来的执行方法
            this.comopent.opr();
        }

    }
}
